home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 November / Macworld (1999-11).dmg / Updaters / WhiteCap 3.0.4 / WhiteCap Source.sit / WhiteCap Source / Headers / WhiteCap.h < prev    next >
C/C++ Source or Header  |  1999-08-30  |  3KB  |  106 lines

  1. #pragma once
  2.  
  3.  
  4. #include "WhiteCapWorld.h"
  5. #include "PixPort.h"
  6. #include "FileSpecList.h"
  7. #include "Prefs.h"
  8. #include "XLongList.h"
  9.  
  10. #if EG_MAC
  11. #include <Files.h>
  12. #endif
  13.  
  14. #define cWhiteCapID        'WCap'
  15. #define cPluginAuthor    'Av55'
  16.  
  17. class WhiteCap {
  18.  
  19.     public:    
  20.         
  21.         // Once you make a new WhiteCap, don't do anything else until you call SetPort() or SetWinRect()
  22.                                 WhiteCap( CEgFileSpec& inPluginsFolder, void* inRefCon = NULL );
  23.                                 ~WhiteCap();
  24.  
  25.         // Calling this assumes that the GrafPort WhiteCap has is a window.  This call simply is a 
  26.         // MacOS/Win32 util to get a rect for the OS window size
  27.         void                    GetWinRect( Rect& outRect );
  28.         
  29.         // Tell's WhiteCap, "work inside this grafPort and keep your slimy butt inside inRect"
  30.         // inAtFullsceen is needed because WC responds to input differently if it's fullscreen mode vs. no.
  31.         void                    SetPort( GrafPtr inPort, const Rect& inRect, bool inAtFullsceen );
  32.         
  33.         // Use this call (instead of SetPort()) when WhiteCap's
  34.         // is in control of its own window (ie, in MacAMP and Winamp)--this call will make a call to
  35.         // SetPort().  In other words, this call is like SetPort() but it also
  36.         // correctly positions WhiteCap's window for you, changing inRect from global cords to local cords
  37.         // If inRect is invalid or NULL, the prefs are used 
  38.         void                    SetWinPort( GrafPtr inPort, const Rect* inRect = NULL );
  39.         
  40.  
  41.  
  42.         void                    RecordSample( long inTime, float inSpectrum[] );
  43.  
  44.         void                    Draw();
  45.         
  46.         void                    SetFullScreen( bool inFullScreen );
  47.         inline bool                IsFullScreen()        { return mAtFullScreen;    }
  48.         
  49.         void                    RefreshRect( const Rect& inUpdate );
  50.  
  51.         void                    SelectConfig();
  52.  
  53.         void                    ToggleFrameCounter()                    { mFrameCount = (mFrameCount >= 0) ? -1 : 0;    }
  54.  
  55.  
  56.         bool                    PtInTitle( Point inPt );
  57.  
  58.     protected:
  59.         bool                    mDoingSetPortWin;    // true when a thread is currently inside SetPortWin()
  60.         Rect                    mWinRectHolder;        // Win rect holder while we're n FS mode
  61.         Rect                    mDispRect;            // Local cords rect within mOSPort we can draw in
  62.         bool                    mMouseWillAwaken;    // true if moving the mouse will exit fullscreen mode
  63.         GrafPtr                    mOSPort;
  64.         FileSpecList            mConfigs;
  65.         int                        mCurConfigNum;
  66.         XLongList                mConfigPlayList;
  67.         PixPort                    mPort;
  68.         long                     mNextShapeChange;
  69.         bool                    mInSlideShowMode;
  70.         Prefs                    mPrefs;
  71.     
  72.         
  73.         // Plugin prefs
  74.         long                    mSlideShowInterval;
  75.         long                    mScrnSaverDelay;
  76.         long                    mTransitionLo;
  77.         long                    mTransitionHi;
  78.  
  79.         
  80.         // For dumping raw spectrum data
  81.         UtilStr                    mDumpData;
  82.                 
  83.         #define MAX_WORLDS        10
  84.         long                    mNumWorlds;    
  85.         WhiteCapWorld*            mWorld[ MAX_WORLDS ];
  86.  
  87.         // Stuff dealing with full screen mode
  88.         bool                    mAtFullScreen;
  89.         Point                    mLastMousePt;
  90.         long                    mLastActiveTime;
  91.         long                    mFullscreenStartTime;
  92.         
  93.         // Frame rate/calc members.  mFrameCount >= 0 if frame counting/displaying is on
  94.         UtilStr                    mFrameRate;
  95.         long                    mFramesPer10Secs;
  96.         long                    mFrameCountStart;
  97.         long                    mFrameCount;
  98.         
  99.         void                    BuildConfigList( CEgFileSpec& inPluginsFolder );
  100.         void                    LoadConfig( int inConfigNum );
  101.         
  102.         //  Chops up mDispRect into smaller rects, making a rect for each config to be shown.
  103.         void                    ResizeWorlds();
  104.  
  105.         void *                    mRefCon;
  106. };